package jm.data.structure.trie;

/**
 * @Description 前缀树测试
 * @date 2022/5/1 8:05
 */
public class TrieMain {
    public static void main(String[] args) {
        Trie<Integer> trie = new Trie<>();
        trie.add("dog",1);
        trie.add("doggy",2);
        trie.add("cat",3);
        trie.add("cast",4);
        trie.add("大帅哥",0);
        trie.add("大帅哥是我",45);


        System.out.println(trie.size());
        System.out.println(trie.contains("dog"));
        System.out.println(trie.contains("doggy"));
        System.out.println(trie.get("cat"));
        System.out.println(trie.get("cast"));
        System.out.println(trie.get("大帅哥"));
        System.out.println(trie.contains("大帅哥是我"));
        System.out.println(trie.startWith("大帅哥"));
        System.out.println(trie.startWith("大"));
        System.out.println(trie.startWith("大帅哥是我"));
        System.out.println(trie.startWith("帅哥是我"));


        System.out.println(trie.remove("大帅哥是我"));
        System.out.println(trie.contains("大帅哥"));
    }
}
